/*
 * Copyright 2009 SHOP.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shop.opensocial.mediated.shindig.factories;

import org.apache.shindig.social.core.model.OrganizationImpl;
import com.shop.opensocial.mediated.types.AddressMediator;
import com.shop.opensocial.mediated.types.OrganizationMediator;
import org.apache.shindig.social.opensocial.model.Organization;
import java.util.Date;

/**
 * Factory for converting between Mediator type and Shindig type
 *
 * @author Jordan Zimmerman
 */
public class OrganizationMediatorFactory extends GenericMediatorFactory<Organization, OrganizationMediator>
{
	public static final GenericMediatorFactoryBase<Organization, OrganizationMediator>		i = new OrganizationMediatorFactory();

	@Override
	protected Organization internalMake(OrganizationMediator mo)
	{
		Organization		o = new OrganizationImpl();
		o.setAddress(AddressMediatorFactory.i.make(mo.getAddress()));
		o.setDescription(mo.getDescription());
		o.setEndDate(mo.getEndDate());
		o.setField(mo.getField());
		o.setName(mo.getName());
		o.setPrimary(mo.getPrimary());
		o.setSalary(mo.getSalary());
		o.setStartDate(mo.getStartDate());
		o.setSubField(mo.getSubField());
		o.setTitle(mo.getTitle());
		o.setType(mo.getType());
		o.setWebpage(mo.getWebpage());

		return o;
	}

	@Override
	protected OrganizationMediator internalUnmake(final Organization c)
	{
		return new OrganizationMediator()
		{
			@Override
			public AddressMediator getAddress()
			{
				return AddressMediatorFactory.i.unmake(c.getAddress());
			}

			@Override
			public String getDescription()
			{
				return c.getDescription();
			}

			@Override
			public Date getEndDate()
			{
				return c.getEndDate();
			}

			@Override
			public String getField()
			{
				return c.getField();
			}

			@Override
			public String getName()
			{
				return c.getName();
			}

			@Override
			public String getSalary()
			{
				return c.getSalary();
			}

			@Override
			public Date getStartDate()
			{
				return c.getStartDate();
			}

			@Override
			public String getSubField()
			{
				return c.getSubField();
			}

			@Override
			public String getTitle()
			{
				return c.getTitle();
			}

			@Override
			public String getWebpage()
			{
				return c.getWebpage();
			}

			@Override
			public String getType()
			{
				return c.getType();
			}

			@Override
			public Boolean getPrimary()
			{
				return c.getPrimary();
			}
		};
	}

	private OrganizationMediatorFactory()
	{
	}
}
